
// MFC_OpenGlView.h : interface of the CMFC_OpenGlView class
//

#pragma once
#include "stdafx.h"
#include "MagicCube.h"
#include "Floor.h"
#include "MagicCubeGame.h"
#include "MFC_OpenGlDoc.h"
#include "HandelControl.h"
class CMFC_OpenGlView : public CView
{
protected: // create from serialization only
	CMFC_OpenGlView();
	DECLARE_DYNCREATE(CMFC_OpenGlView)

// Attributes
public:
	CMFC_OpenGlDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	

// Implementation
public:
	virtual ~CMFC_OpenGlView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	int m_GLPixelIndex;
	HGLRC m_hGLContext;
	HDC hDC;
	bool m_TimerStarted;
	MagicCubeGame * game;
	Floor *floor;
	HandelControl* control;
	float width;
	float height;
	float lastX;
	float lastY;
// Generated message map functions
protected:
	afx_msg void OnFilePrintPreview();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	DECLARE_MESSAGE_MAP()
	bool SetWindowPixelFormat(HDC hDC);
	bool CreateViewGLContext(HDC hDC);
	void CALLBACK TimeProc(HWND hwnd, UINT uint, UINT_PTR uptr, DWORD dword);
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
protected:
	void DrawGlScene(void);
public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	void DrawXYZ(void);
	void DrawTeapot(void);
	void AddOperation(MagicCubeOperation* operation);
	//void DrawTestModel(void);
	void SetupLight(int lightType);
	void DrawObject(GLfloat x,GLfloat y,GLfloat z);
	void SetGamePosition(GLfloat x,GLfloat y,GLfloat z);
//	afx_msg void On32771();
	afx_msg void OnRandrota();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnHandControl();
	afx_msg void OnResetControl();
	afx_msg void OnStepUndo();
	afx_msg void OnStepsUndo();
};

#ifndef _DEBUG  // debug version in MFC_OpenGlView.cpp
inline CMFC_OpenGlDoc* CMFC_OpenGlView::GetDocument() const
   { return reinterpret_cast<CMFC_OpenGlDoc*>(m_pDocument); }
#endif

